package top.yaofengqiao.springcloudsimple.demo.biz.trigger.http.admin;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.yaofengqiao.springcloudsimple.common.util.R;

/**
 * @author yfq
 * @date 2024/6/3 15:08
 * @description
 */
@RestController
@RequestMapping("/adminTest")
public class AdminTestController {

    @PreAuthorize("@mp.hasAnyRole('admin','super_admin','operator')")
    @GetMapping("/testRole")
    public R<String> testRole() {
        return R.ok("testRole success");
    }

    @PreAuthorize("@mp.hasPermission('test_permission')")
    @GetMapping("/testPermission")
    public R<String> testPermission() {
        return R.ok("testPermission success");
    }

}
